import { Component } from 'react';
import './Header.css'
class Header extends Component {
    constructor(props) {
        super()
        console.log(props)
    }
    setTodo = (e) => {
        // console.log(e)
        if(e.keyCode === 13) {
            this.props.getFun(e.target.value)
            e.target.value = ''
        }
        
    }
    render() {
        return (
            <div id="header">
                <header>
                    <span>TODOLIST</span>
                    <input placeholder="添加todo" onKeyUp={this.setTodo}/>
                </header>
            </div>
        )
    }
}

export default Header